import axios from 'axios';

export default {
    install: function(Vue, options) {

        let service = {
            // 查询餐食订阅数量
            QueryMealsCount: (condition) => {
                return axios.post('/meal/query/count', condition);
            },

            // 查询餐食订阅列表
            QueryMeals: (condition, pageIndex, pageSize) => {
                return axios.post(`/meal/query?pageIndex=${pageIndex}&pageSize=${pageSize}`, condition);
            },

            // 查询所有房型预定数量
            // QueryQuantity: () => {
            //     return axios.get('/meal/query/quantity');
            // },

            // 导出比赛列表
            Export: (condition) => {
                return axios.post('/meal/export', condition)
                    .then(ret => {
                        var link = aphf.file.ADDR + '/' + ret;

                        var a = document.createElement("a");
                        a.download = 'Meals.xls';
                        a.href = link;
                        a.click();
                    })
            }
        }

        Vue.prototype.$MealService = service;
    }
}